<?php

require_once './config.php';

$id = $_REQUEST['id'];
$count = $_REQUEST['count'];

$sql = "UPDATE cartinfo SET count = $count WHERE id = $id";

mysqli_query($conn, $sql);

$rows = mysqli_affected_rows($conn);

if($rows > 0) {
  echo json_encode(array(
    'code' => 1
  ));
} else {
  echo json_encode(array(
    'code' => 0,
    'msg'  => '失败'
  ));
}